<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-11-10 14:28:34
         compiled from "H:\WebApplication\myconpany\sumi_mobile\application\views\event\sample.html" */ ?>
<?php /*%%SmartyHeaderCode:15209561f5da776bdd3-59442142%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '49cce1173b601f294087058a164368f668281613' => 
    array (
      0 => 'H:\\WebApplication\\myconpany\\sumi_mobile\\application\\views\\event\\sample.html',
      1 => 1447136909,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '15209561f5da776bdd3-59442142',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.21-dev',
  'unifunc' => 'content_561f5da78f0854_71436177',
  'variables' => 
  array (
    'activityskuinfo' => 0,
    'item' => 0,
    'logininfo' => 0,
    'userinfo' => 0,
    'province' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_561f5da78f0854_71436177')) {function content_561f5da78f0854_71436177($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ((@constant('APPLICATION_PATH')).("/application/views/header.html"), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>


<style>
    .tmg1{width:100%;float:left;}
    .tmg1 img{vertical-align: top;width:100%;float:left;}
    .tmg1 div{width:90px;margin:0 auto;}
    .tmg1 div p{border:1px solid #ccc;background:#f7f7f5;padding:3px 5px;vertical-align: middle;border-radius:5px;}
    .tmg1 div p img{float:left;margin-top:2px;margin-right:3px;}
    /*.wr_mfsy{padding:0 10px;margin-top:10px;}*/
    .wr_mfsy table{width:100%;}
    .wr_mfsy table tr th{text-align: center; background: #dcdcdc;line-height:36px;}
    .wr_mfsy table tr td{text-align: center;line-height:32px;background:#fff;border-bottom:1px solid #f4f4f4;width:16.6666666%;padding:6px 0;}
    .hdsm{background:#ff554c;padding:10px; box-sizing:border-box;line-height:26px;color:#fff;}
    .hdsm h3{ font-size:14px;}
    .mui-dialog-mask{ position:fixed;left:0;top:0;width:100%;height:100%;background:#000;opacity:0.6;}
    .mui-dialog{width:90%;background:#fff;left:5%;position:fixed;top:10%;box-sizing:border-box;}
    .empty{color:#ff6600;}
    .pr5{color:#ff6600;padding-right:5px;}
    .se_t{border:1px solid #dedede;resize:none;width:70%;height:50px;margin-top:10px;padding:5px;}
    .ad_btn{background:#1caaeb;border:0 none;color:#fff;cursor:pointer;height:30px;margin-left:60px;width:120px;}
    .new_ph_text{width:45%;border:1px solid #dedede;padding:4px 5px}

a.ljsq{color:#fff;background:#ff6600;display: inline-block;width:60px;text-align: center;line-height:28px;}
a.ljsq:hover{color:#fff;}

.overlay-close{float:right;z-index:3;background:url(/images/tmclose.png) no-repeat 0 0;width:16px;height:16px;display: block;outline:medium none;margin-top:10px;}
a.overlay-close:hover{background:url(/images/tmclose.png) no-repeat -16px 0;}

.se_m{padding: 4px 5px; border: 1px solid #dedede;width:25%;}
    .pb20p{padding-bottom:20px;}


</style>
<?php echo '<script'; ?>
 type="text/javascript">
    $(function(){

    function ShowDiv(){
        window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=false;
            e.stopPropagation && e.stopPropagation();
            return false;
        }
    };

    function CloseDiv(){
        window.ontouchmove=function(e){
            e.preventDefault && e.preventDefault();
            e.returnValue=true;
            e.stopPropagation && e.stopPropagation();
            return true;
        }

    };

        $('.ljsq').click(function(e){
            e.preventDefault();
            ShowDiv();
            var t1 = $(this).closest('tr').find('.mmm1').text();
            var t2 = $(this).closest('tr').find('.mmm2').text();
            var t3 = $(this).closest('tr').find('.mmm3').text();
            var t4 = $(this).closest('tr').find('.mmm4').text();
            var product_id = $(this).attr("var");
            $('.ttt1').text(t1);
            $('.ttt2').text(t2);
            $('.ttt3').text(t3);
            $('.ttt4').text(t4);
            var content = t1 +" "+ t2 +" "+ t3 +" "+ t4;
            $("input[name=content]").val(content);
            $("#product_id").val(product_id);
            $('.sample_remove').show();
            $('.mui-dialog-mask').show();
            $('.mui-dialog').show();

        });

        $('.overlay-close').click(function(){
            CloseDiv();
            $('.mui-dialog-mask').hide();
            $('.mui-dialog').hide();
        });

    });


    $(function(){
        $(document).delegate(".provice_id", "change", function(e){
            var proviceid = $(this).val();

            if(proviceid=="请选择"){
                return false;
            }
            var purl = "/region/getprovice";
            $.ajax({
                url: purl,//请求的地址
                type:'post',
                dataType: "json",//请求的数据格式
                data: {
                    proviceid: proviceid //请求的数据
                },
                success: function(data) {
                    if(data=='-1'){
                        alert("请先选择省份!");return false;
                    }else{
                        $(".city_id option").remove();
                        var html = "<option>请选择</option>";
                        for(var k in data){
                            html +="<option value=\""+data[k].region_id+"\">"+data[k].region_name+"</option>";
                        }
                        $(".city_id").append(html);
                    }
                }
            });
        });

        $(document).delegate(".city_id", "change", function(e){
            var city_id = $(this).val();
            if(city_id=="请选择"){
                alert("请先选择！"); return false;
            }
            var aurl = "/region/getarea";
            $.ajax({
                url: aurl,//请求的地址
                type:'POST',
                dataType: "json",//请求的数据格式
                data: {
                    cityid: city_id //请求的数据
                },
                success: function(data) {
                    if(data=='-1'){
                        alert("请先选择城市!");return false;
                    }else{
                        $(".area_id option").remove();
                        var html = "<option>请选择</option>";
                        for(var k in data){
                            html +="<option value=\""+data[k].region_id+"\">"+data[k].region_name+"</option>";
                        }
                        $(".area_id").append(html);
                    }
                }
            });
        });

        $(".add_btn").click( function(e){
            if(checkSubmitMobil($('input[name=mobile]'))==false||nEmpty($('input[name=conpany_name]'),'公司名称不能为空！','公司名称太长或太短,请重新输入！','公司名称不能为数字!','公司名称填写正确！')==false||
                    nEmpty($('input[name=username]'),'联系人不能为空！','联系人太长或太短,请重新输入!','联系人不能为数字!','联系人填写正确！')==false || nEmpty($('.detail_addr'),'收货地址不能为空！','收货地址太长或太短,请重新输入!','收货地址不能为数字!','收货地址填写正确！')==false){
                return false;
            }else{
                var content = $("input[name=content]").val();
                var conpany_name = $('input[name=conpany_name]').val();
                var mobile = $('input[name=mobile]').val();
                var username = $('input[name=username]').val();
                var provice_id = $('.provice_id').val();
                var city_id = $('.city_id').val();
                var area_id = $('.area_id').val();
                var detail_addr = $('.detail_addr').val();
                var customer_remark = $('.customer_remark').val();
                var product_id = $('#product_id').val();



                $.ajax({
                    url:'/event/sample',
                    data:{content:content,conpany_name:conpany_name,mobile:mobile,username:username,provice_id:provice_id,city_id:city_id,area_id:area_id,detail_addr:detail_addr,customer_remark:customer_remark,product_id:product_id},
                    type:'POST',
                    success:function(data){
                        var data = eval("("+data+")");
                        if(data.code == '8'){
                            alert("申请成功！");
                            window.location.reload();

                        }else{
                            alert("申请不成功！");
                            window.location.reload();
                        }
                        return false;
                    },
                    dataType:'text'
                });
            }
        });



        function nEmpty(obj,txt1,txt2,txt3,txt4){
            Value = obj.val();
            if(Value==''){
                obj.siblings('.empty').html("<font class='red pl10'>"+txt1+"</font>");
                return false;
            }else if(Value.length<=2||Value.length>=60){
                obj.siblings('.empty').html("<font class='red pl10'>"+txt2+"</font>");
                return false;
            }else if(!isNaN(obj.val())){
                obj.siblings('.empty').html("<font class='red pl10'>"+txt3+"</font>");
                return false;
            }else{
                obj.siblings('.empty').html("<font class='green pl10'>"+txt4+"</font>");
                return true;
            }
        }

        function checkSubmitMobil(obj){
            if(obj.val()==""){
                obj.siblings('.empty').html("<font class='red pl10'>手机号码不能为空！</font>");
                return false;
            }
            if(!obj.val().match(/^(?:13\d|15\d|18\d)\d{5}(\d{3}|\*{3})$/)){
                obj.siblings('.empty').html("<font class='red pl10'>手机号码格式不正确,请重新输入！</font>");
                return false;
            }else{
                obj.siblings('.empty').html("<font class='green pl10'>手机号码正确！</font>");
                return true;
            }
        }

        $('input[name=conpany_name]').blur(function(){
            nEmpty($('input[name=conpany_name]'),'公司名称不能为空！','公司名称太长或太短,请重新输入！','公司名称不能为数字!','公司名称填写正确！');
        });

        $('input[name=username]').blur(function(){
            nEmpty($('input[name=username]'),'联系人不能为空！','联系人太长或太短,请重新输入!','联系人不能为数字!','联系人填写正确！');
        });

        $('input[name=mobile]').blur(function(){
            checkSubmitMobil($('input[name=mobile]'));
        });

        $('.detail_addr').blur(function(){
            nEmpty($('.detail_addr'),'收货地址不能为空！','收货地址太长或太短,请重新输入!','收货地址不能为数字!','收货地址填写正确！');
        });
    });

<?php echo '</script'; ?>
>





<section class="wrap">

    <div class="tmg1">
        <img src="/images/temp/mf1.jpg" width="100%">
        <img src="/images/temp/mf2.jpg" width="100%">
    </div>

    <div class="wr_mfsy">
        <table>
            <tr>
                <th>品种</th>
                <th>牌号</th>
                <th>厂商</th>
                <th>操作</th>
            </tr>
            <?php if ($_smarty_tpl->tpl_vars['activityskuinfo']->value!='') {?>
                <?php  $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['item']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['activityskuinfo']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value) {
$_smarty_tpl->tpl_vars['item']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
?>
                <tr>
                    <td class="mmm1"><?php echo $_smarty_tpl->tpl_vars['item']->value['cate_name'];?>
</td>
                    <td class="mmm2"><?php echo $_smarty_tpl->tpl_vars['item']->value['product_name'];?>
</td>
                    <td class="mmm3"><?php echo $_smarty_tpl->tpl_vars['item']->value['brand_name'];?>
</td>

                    <?php if ($_smarty_tpl->tpl_vars['logininfo']->value!='') {?>
                        <?php if ($_smarty_tpl->tpl_vars['item']->value['is_application']=='Y') {?>
                        <td><a href="javascript:void(0)" var="<?php echo $_smarty_tpl->tpl_vars['item']->value['product_id'];?>
" class="ljsq">立即申请</a></td>
                        <?php } else { ?>
                        <td><a href="javascript:void(0)" class="gray" title="您已经申请过相同的产品">已申请过</a></td>
                        <?php }?>
                    <?php } else { ?>
                        <td><a href="/login" class="gray" title="请登录会员后在申请！">登录申请</a></td>
                    <?php }?>
                </tr>
                <?php } ?>
            <?php } else { ?>
                <tr >
                    <td colspan="4">暂无任何数据！</td>
                </tr>
            <?php }?>
        </table>
    </div>

    <div class="hdsm">
        <h3>活动规则：</h3>
        <p>1.仅塑米城会员享有此项服务</p>
        <p>2.其中免费试样产品抢完即止</p>
        <p>3.试样产品包装规格：1公斤（注：超出1公斤请联系客服申请或另外购买，单品总量不超过25公斤）</p>
        <p>4.同一种产品，每位会员仅享有一次免费试样的机会</p>
        <p>5.如有疑问请联系客服热线：4009-911-900</p>
        <p>6.塑米城保留在法律规定的范围内对上述规则进行解释的权利</p>
    </div>


    <div class="mui-dialog-mask" style="display:none;"></div>
    <div class="mui-dialog" style="display:none;">

        <div class="eject_titie">试样产品<a href="javascript:void(0)" class="overlay-close"></a></div>
        <div class="pl10p pr10p pt10p pb20p">
            <div class="pb10" style="padding-bottom:10px;">试样产品：
                <span class="ttt1 pr5"></span>
                <span class="ttt2 pr5"></span>
                <span class="ttt3 pr5"></span>
                <span class="ttt4 pr5"></span>
                <input id="content" type="hidden" name="content"/>
                <input id="product_id" type="hidden" name="product_id"/>
            </div>

        <div class="qg_text clearfix" style="padding-bottom:10px;">公司名称：<input type="text" placeholder="请输入公司名称"   class="new_ph_text" name="conpany_name" value="<?php echo $_smarty_tpl->tpl_vars['userinfo']->value['business_name'];?>
"/>
            <span class="empty" >*</span>
        </div>

        <div class="qg_text clearfix" style="padding-bottom:10px;">　联系人：<input type="text" placeholder="请输入联系人" value="<?php echo $_smarty_tpl->tpl_vars['userinfo']->value['contacts'];?>
"   class="new_ph_text username" name="username"/>
            <span class="empty" >*</span>
        </div>

        <div class="qg_text clearfix" style="padding-bottom:10px;">手机号码：<input type="text" placeholder="请输入手机号码"  value="<?php echo $_smarty_tpl->tpl_vars['userinfo']->value['mobile'];?>
"  class="new_ph_text mobile" name="mobile"/>
            <span class="empty">*</span>
        </div>

        <div class="qg_text clearfix" style="padding-bottom:10px;">配送地址：<select class="se_m provice_id" name="provice_id">
            <option>请选择</option>

            <?php  $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['item']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['province']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value) {
$_smarty_tpl->tpl_vars['item']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
?>
            <option value="<?php echo $_smarty_tpl->tpl_vars['item']->value['region_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['item']->value['region_name'];?>
</option>
            <?php } ?>
        </select>
            <select class="se_m city_id" name="city_id">
                <option>请选择</option>
            </select>
            <select class="se_m area_id" name="area_id">
                <option>请选择</option>
            </select>
        </div>
        <div class="qg_text clearfix" style="padding-bottom:10px;padding-left:60px;"><textarea class="se_t detail_addr" style="margin-top:0;height:20px;"></textarea><p class="empty" ></p></div>


        <div class="qg_text clearfix" style="padding-bottom:10px;"><i class="fl">客户备注：</i><textarea  style="margin-top:0;" class="se_t customer_remark"></textarea><span class="empty" ></span></div>
        <div class="buy_btn pl88  clearfix" style="padding-top:0;"><input type="button" class="ad_btn add_btn" qid="" value="提 交"></div>

    </div>
</div>

    <?php echo $_smarty_tpl->getSubTemplate ((@constant('APPLICATION_PATH')).("/application/views/common/footerlogin.html"), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>



</section>

<?php echo $_smarty_tpl->getSubTemplate ((@constant('APPLICATION_PATH')).("/application/views/footer.html"), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>

<?php }} ?>
